package com.fay.designPattern.oop.basic;

import java.awt.*;

/**
 * @Title:
 * @Description:
 * @Author Fay Wang
 * @Date 2022/2/21 20:49
 * @Version 1.0
 */
public class AliImageStore implements ImageStore {
    // 省略属性、构造函数

    @Override
    public String upload(Image image, String bucketName) {
        createBucketIfNotExisting(bucketName);
        String accessToken = generateAccessToken();
        // 上传图片到aliyun
        // 返回url
        return null;
    }

    @Override
    public Image download(String url) {
        String accessToken = generateAccessToken();
        // 从aliyun下载图片
        return null;
    }

    private String generateAccessToken() {
        // 根据accesskey和secretkey生成accessToken
        return "";
    }

    private void createBucketIfNotExisting(String bucketName) {
        // 创建bucket
        // 失败抛出异常
    }


}
